﻿<script type="text/javascript">
    var d = document;
    var safari = (navigator.userAgent.toLowerCase().indexOf('safari') != -1) ? true : false;
    var gebtn = function (parEl, child) { return parEl.getElementsByTagName(child); };
    onload = function () {
        var body = gebtn(d, 'body')[0];
        body.className = body.className && body.className != '' ? body.className + ' has-js' : 'has-js';
        if (!d.getElementById || !d.createTextNode) {
            return;
        }
        var ls = gebtn(d, 'label');
        for (var i = 0; i < ls.length; i++) {
            var l = ls[i];
            if (l.className.indexOf('label_') == -1) {
                continue;
            }
            var inp = gebtn(l, 'input')[0];
            if (l.className == 'label_check') {
                //l.className = (safari && inp.checked == true || inp.checked) ? 'label_check c_on' : 'label_check c_off';
                l.className = (safari && inp.checked == true || inp.checked) ? 'label_check c_off' : 'label_check c_on';
                l.onclick = check_it;
            };
            if (l.className == 'label_radio') {
                l.className = (safari && inp.checked == true || inp.checked) ? 'label_radio r_on' : 'label_radio r_off';
                l.onclick = turn_radio;
            };
        };
    };
    var check_it = function () {
        var inp = gebtn(this, 'input')[0];
        if (this.className == 'label_check c_off' || (!safari && inp.checked)) {
            this.className = 'label_check c_on';
            if (safari) {
                inp.click();
            };
        } else {
            this.className = 'label_check c_off';
            if (safari) {
                inp.click();
            };
        };
    };
    var turn_radio = function () {
        var inp = gebtn(this, 'input')[0];
        if (this.className == 'label_radio r_off' || inp.checked) {
            var ls = gebtn(this.parentNode, 'label');
            for (var i = 0; i < ls.length; i++) {
                var l = ls[i];
                if (l.className.indexOf('label_radio') == -1) {
                    continue;
                };
                l.className = 'label_radio r_off';
            };
            this.className = 'label_radio r_on';
            if (safari) {
                inp.click();
            };
        } else {
            this.className = 'label_radio r_off';
            if (safari) {
                inp.click();
            };
        };
    }; 
 </script>
 <script type=text/javascript>
  String.prototype.Format = function () {
	var tmpStr = this;
	var iLen = arguments.length;
	for (var i = 0; i < iLen; i++) {
		tmpStr = tmpStr.replace(new RegExp("\\{" + i + "\\}", "g"), arguments[i]);
	}
	return tmpStr;
  }
 Calendar = {
	//region Property
	today: new Date(),
	year: 3005,
	month: 8,
	date: 21,
	curPosX: 0,
	curPosY: 0,
	curCapture: null,
	curDay: null,
	//endregion

	//region Method
	display:
  function (o, e, d) {
      with (Calendar) {
          o = typeof (o) == "object" ? o : document.getElementById(o);
          if (window.event) {
              curPosX = document.body.scrollLeft + event.x;
              curPosY = document.body.scrollTop + event.y;
          } else {
              curPosX = e.pageX;
              curPosY = e.pageY;
          }
          if (o.value == "" && d) o.value = d;
          with (document.getElementById("Calendar__")) {
              if (o != curCapture) {
                  curCapture = o;
                  if (style.display == "block") {
                      style.left = curPosX + "px";
                      style.top = curPosY + "px";
                  }
                  else load();
              }
              else {
                  if (style.display == "block") style.display = "none";
                  else load();
              }
          }
      }
  },
			        load:
  function () {
      with (Calendar) {
          curDay = loadDate(curCapture.value);
          with (curDay) {
              year = getFullYear();
              month = getMonth() + 1;
              date = getDate();
          }
          init();
      }
  },
			        init:
  function () {
      with (Calendar) {
          with (new Date(year, month - 1, date)) {
              year = getFullYear();
              month = getMonth() + 1;
              date = getDate();
              setDate(1);
              var first = getDay();
              setMonth(getMonth() + 1, 0)
              paint(first, getDate());
          }
      }
  },
			        paint:
  function (first, last) {
      var calendar = document.getElementById("Calendar__");
      var grid = document.getElementById("dataGrid__");
      var i, l;
      l = Math.ceil((first + last) / 7);
      if (!document.all) {
          calendar.style.height = (41 + 19 * Math.ceil((first + last) / 7)) + "px";
      }
      grid.innerHTML = new Array(l * 7 + 1).join("<li><a></a></li>");
      with (Calendar) {
          var strDate = "{0}/{1}".Format(year, month);
          var isTodayMonth = ((year == today.getFullYear()) && (month == today.getMonth() + 1));
          var isCurdayMonth = ((year == curDay.getFullYear()) && (month == curDay.getMonth() + 1));
          var todayDate = today.getDate();
          for (i = 0; i < last; i++) {
              grid.childNodes[first + i].innerHTML = '<a href="{2}/{1}"{0} onclick="Calendar.setValue({1});return false">{1}</a>'.Format(((i + 1) == todayDate && isTodayMonth) ? ' class="today"' : isCurdayMonth && (i + 1) == curDay.getDate() ? ' class="curDay"' : '', i + 1, strDate);
          }
          document.getElementById("dateText__").innerHTML = '<a href="' + (year - 1) + '年" onclick="Calendar.turn(-12);return false" title="上一年"><img src="../../images/DrawMult1/l-7.gif" width="11" height="11" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="上一月" onclick="Calendar.turn(-1);return false" title="上一月"><img src="../../images/DrawMult1/l-6.gif" width="7" height="11" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + year + " / " + month + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="下一月" onclick="Calendar.turn(1);return false" title="下一月"><img src="../../images/DrawMult1/r-7.gif" width="7" height="11" border="0"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="' + (year + 1) + '年" onclick="Calendar.turn(12);return false" title="下一年"><img src="../../images/DrawMult1/r-6.gif" width="11" height="11" border="0"></a>';
          with (calendar) {
              style.left = Calendar.curPosX + "px";
              style.top = Calendar.curPosY + "px";
              style.display = "block";
          }
      }
  },
			        turn:
  function (num) {
      Calendar.month += num;

      Calendar.date = 1;
      Calendar.init();
  },
			        setValue:
  function (val) {
      with (Calendar) {
          curCapture.value = "{0}/{1}/{2}".Format(year, month, val);
          document.getElementById("Calendar__").style.display = "none";
      }
  },
			        loadDate:
  function (op, formatString) {
      formatString = formatString || "ymd";
      var m, year, month, day;
      switch (formatString) {
          case "ymd":
              m = op.match(new RegExp("^((\\d{4})|(\\d{2}))([/./])(\\d{1,2})\\4(\\d{1,2})$"));
              if (m == null) return new Date();
              day = m[6];
              month = m[5] * 1;
              year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10));
              break;
          case "dmy":
              m = op.match(new RegExp("^(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))$"));
              if (m == null) return new Date();
              day = m[1];
              month = m[3] * 1;
              year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10));
              break;
          default:
              break;
      }
      if (!parseInt(month)) return new Date();
      month = month == 0 ? 12 : month;
      var date = new Date(year, month - 1, day);
      return (typeof (date) == "object" && year == date.getFullYear() && month == (date.getMonth() + 1) && day == date.getDate()) ? date : new Date();
      function GetFullYear(y) { return ((y < 40 ? "20" : "19") + y) | 0; }
  },
		toString: function () { return ["Calendar v1.0", "author:time", "email:wfsr@msn.com", "version:1.0"].join("\n"); }
		//endregion
	}
	var __calendar_html = "<style>";
	__calendar_html += "#Calendar__ {background-color:#eeeeee;width:284 !important;width:285px;height: 318;position:absolute;display:none;background:url(../../images/DrawMult1/t-4.gif)}";
	__calendar_html += "#Calendar__ ul{list-style-type:none;margin-left:-3px !important;margin:0 0 0 2px;height: 26;width:284px;}";
	__calendar_html += "#Calendar__ ul li{display:block;width:40px;height:30px;margin:0px;text-align:center;float:left;font:12px Tahoma;color: #31546C;font-size: 11px; font-weight: bold;font-family: Helvetica;}";
	__calendar_html += "#Calendar__ ul li a{height:30px;display:block;line-height:30px;text-decoration:none;color:#8D9EAB;font-size: 12px;font-family: Helvetica;}";
	__calendar_html += "#Calendar__ ul li a:hover{background:#336699;color:#AB9F8D;font-size: 12px;height:30px;font-family: Helvetica;}";
	__calendar_html += "#Calendar__ #dateText__{font:12px Tahoma;text-align:center;}";
	__calendar_html += "#Calendar__ #dateText__ a{font:10px Tahoma;height:px;}";
	__calendar_html += "#Calendar__ #head__ li a{font:bold 12px Tahoma}";
	__calendar_html += "#Calendar__ #dataGrid__{}";
	__calendar_html += "#Calendar__ #dataGrid__ li a:hover{background:#dedede url(../../images/DrawMult1/t-3.gif) right bottom no-repeat;color:#fff}";
	__calendar_html += "#Calendar__ #dataGrid__ .today{background:url(../../images/DrawMult1/t-2.gif) center no-repeat;color:#074669;}";
	__calendar_html += "#Calendar__ #dataGrid__ .curDay{background:#dedede url(../../images/DrawMult1/t-3.gif) right bottom no-repeat;color:#fff;}";
	__calendar_html += "</style>";

	__calendar_html += "<div id=\"Calendar__\" >";
	__calendar_html += "<div style=\"height:5\"></div>";
	__calendar_html += "<div id=\"dateText__\"  style=\"font-size\: 18px\;color\:\#DB7102\;\"></div>";
	__calendar_html += "<div style=\"height:1\"></div>";
	__calendar_html += "<ul id=\"head__\" onclick=\"return false\">";
	__calendar_html += "<li>Sun</li><li>Mon</li><li>Tue</li><li>Wed</li><li>Thu</li><li>Fri</li><li>Sta</li>";
	__calendar_html += "</ul>";
	__calendar_html += "<ul id=\"dataGrid__\"></ul>";
	__calendar_html += "</div>";
	document.write(__calendar_html);
</script>

<script type="text/javascript">
    function grid(o, a, b, c, d) {

        var t = document.getElementById(o).getElementsByTagName("tr");

        for (var i = 0; i < t.length; i++) {

            t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;

            t[i].onclick = function () {
                if (this.x != "1") {
                    this.x = "1";
                    this.style.backgroundColor = d;
                } else {
                    this.x = "0";
                    this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
                }
            }

            t[i].onmouseover = function () {
                if (this.x != "1") this.style.backgroundColor = c;
            }

            t[i].onmouseout = function () {
                if (this.x != "1") this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
            }
        }
    }
</script>